#pragma once

#include "LayerBase.h"
#include "ui/UIListView.h"
#include "entity/GLPrivateBodyPack.h"
#include "GLGlobalInfo.h"
#include <vector>

#define Invalid_Index		INVALID_INDEX

class CLayerContainerBody : public CLayerBase {
	struct BodyItemData {
		BodyItemData() : m_index(Invalid_Index) {}
		BodyItemData(const GoodsInfo& info, uint8_t index) : m_BodyInfo(info), m_index(index) {}
		GoodsInfo				m_BodyInfo;
		uint8_t					m_index;
	};
	typedef std::vector<BodyItemData>				VecBodyData_t;
public:
	CLayerContainerBody(void);
	virtual ~CLayerContainerBody(void);
	CREATE_FUNC(CLayerContainerBody);

	bool init() override;
	virtual void onEnter() override;
	//virtual void onExit() override;
	//virtual void update(float delta) override;

	static void SetBodyStatus(BodyStatusModel model, uint8_t index);
private:
	void onClose(cocos2d::Ref* pSender, cocos2d::ui::TouchEventType type);
	void onStatusBattle(cocos2d::Ref* pSender, cocos2d::ui::TouchEventType type);
	void onItem(cocos2d::Ref* pSender, cocos2d::ui::TouchEventType type);
	void onSelectedItemEvent(Ref *pSender, cocos2d::ui::ListViewEventType type);
private:
	VecBodyData_t				m_ItemData;
	cocos2d::Node*				m_NodeBody;

	CGLPrivateBodyPack*			m_ContainerBody;
	static BodyIndexStatusInfo	m_BodyStatus;
};

